<template>
  <el-card>
    <template #header> <div class="title">工作日历</div> </template>
    <div style="text-align: right">
      <!-- 时间选择 -->
      <el-select v-model="year" size="small" class="left">
        <el-option
          v-for="(item, index) in yearArr"
          :key="index"
          :label="item"
          :value="item"
        />
      </el-select>
      <el-select v-model="month" size="small" class="right">
        <el-option
          v-for="(item, index) in monthArr"
          :key="index"
          :label="item"
          :value="item"
        />
      </el-select>
    </div>
    <!-- 日历组件 -->
    <el-calendar v-model="value">
      <template #dateCell="{ data }">
        <div class="date">
          <span>{{ data.day.split('-')[2] }}</span>
          <span v-if="false" class="bgcolor">休</span>
        </div>
      </template>
    </el-calendar>
  </el-card>
</template>

<script>
export default {
  name: 'ClendarCom',

  props: {},
  data() {
    return {
      year: '',
      yearArr: [],
      month: '',
      monthArr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
      value: new Date()
    }
  }
}
</script>

<style lang="scss" scoped>
.title {
  font-size: 24px;
}
::v-deep .el-calendar__header {
  display: none;
}
::v-deep .el-calendar__body {
  text-align: center;
}
::v-deep .el-calendar-table .el-calendar-day {
  height: 45px;
  line-height: 25px;
}
::v-deep .el-calendar-table td,
::v-deep .el-calendar-table tr td:first-child,
::v-deep .el-calendar-table tr:first-child td {
  border: none;
}
::v-deep .el-calendar-table thead th {
  font-weight: 700;
}
::v-deep .el-calendar-table thead th:nth-child(n + 6) {
  color: #ff562d;
}
.left {
  width: 130px;
  margin-right: 10px;
}
.right {
  width: 100px;
}
.bgcolor {
  display: inline-block;
  width: 20px;
  height: 20px;
  font-size: 14px;
  line-height: 20px;
  color: #fff;
  background-color: #fa7c4d;
  border-radius: 50%;
  margin-left: 10px;
}
.date {
  width: 100%;
  height: 100%;
}
</style>
